	
<?php	
	require 'libraries/CostLib.php';
	require 'libraries/UserLibrary.php';
	session_start();
	
	isSessionSet("administrator", null, "index.php");

	$mainType = $_GET['mainType'];
	$subType = $_GET['subType'];
	$_SESSION['mainType'] =  $_GET['mainType'];
	$_SESSION['subType'] = $_GET['subType'];
?>	
<html>
	<head>
		<title>CASLIMS | Edit Cost Success</title>
		<link rel="stylesheet" type="text/css" href="scripts/page.css" />
		<link href="tools/favicon.ico" rel="shortcut icon" type="image/x-icon" /> 
	</head>
	<body>
		<div id="header"></div>
		<div id="wrapper">
			<div id="pagetop">
				<div class="greeting">Hi, <?php echo $_SESSION["administrator"];?> | <a href="Logout.php">Log out</a> | <a href="AdministratorHomepage.php"> Home </a></div>
				<div class="homepage"><?php echo $_SESSION["administrator"];?></div>
			</div>
			<?php if(isset($_GET['success'])){?>
				<h2>Cost Successfully Updated!</h2>
			<?php } ?>
			<form name="viewCost" method="POST">
				<input type="hidden" id="subType" value = "<?php echo $subType;?>" />
				<table border='0'>
					<thead>
						<tr>
							<th>ANALYSIS CATEGORY</th>
							<th>ANALYSIS COMPONENT</th>
							<th>COST</th>
						</tr>	
					</thead>
					<?php
					$con = mysql_connect('localhost','editcost','editcost') or die('Could not connect: ' . mysql_error());
					mysql_select_db('casl') or die(mysql_error());
					$result = getLimitedTable($mainType, $subType, "casl", "localhost", "editcost", "editcost");
					foreach ($result as $entry){
					?> 	
						<tr>
							<td><b><?php echo "$entry[1]";?></b></td>
							<td><?php echo "$entry[2]";?></td>
							<td><?php echo "$entry[3]";?></td>
						</tr>
					<?php
					}
					?>		
				</table>
			</form>	
			<div id="buttons">	
			<?php 	
				printf('<input type="button" value="Edit %s Costs" onClick='."'document.location.href = ".'"EditAnalysisCost.php?sample_type=%s"'."'/>",$subType,$subType);
			?>
				<input type="button" value="Back To View Tree" onClick='document.location.href = "ViewAnalysisCosts.php"'>
			</div>
			<div id="footerwrap">
				<div id="footer"> 
					<div class="copyright">Copyright 2011.<a>CASL BIOTECH-UPLB.</a> All Rights Reserved.<br/> 
				Arianne Buse&ntilde;os | Darlene Joy Masong | Rick Jason Obrero | Jonathan Pandi | Jonathan Simbahan | Emmanuel Soriano 
					</div> 
	    	    </div>
			</div>				
		</div>
	</body>
</html>
